Click to See Complete Forum and Search --> : link to send people back


scragar
07-23-2003, 05:46 AM
I'm creating a page, and I came up with an idea on the contact's page, a link that return's then to the earlier page.

I know this can be done using onclick and history.go(-1).

I apoligise for any error's in my post and apreciate any help.

xataku_nakusute
07-23-2003, 05:50 AM
try

<a href="javascript:history.go(-1)">Go Back</a>

and if you want to make it go forward:

<a href="javascript:history.go(+1)">Go Forward</a>

xataku_nakusute
07-23-2003, 05:53 AM
heres the javascript equivalent to the previous if ya want:

<script type="text/javascript">
document.write("<a href=\"javascript:history.go(-1)\">"+"Go Back"+"</a>")
</script>

and for going forward, make the "-1" into "+1"

scragar
07-23-2003, 05:55 AM
thank's.

I am stuck on function's so would you mind helping me with this question?

what are the () for after a function and where do I put what the function is to do?
One last question, how do I call the function when I've created it?

xataku_nakusute
07-23-2003, 06:03 AM
youre lucky, youre in good hands;)

in the <HEAD> section:

<script type="text/javascript">
function back()
{
location="javascript:history.go(-1)"
}
</script>

and then, in your <BODY> section:

<a onClick="back()">Go Back</a>

or you can use it with a button:

<form><input type="button" value="Go Back" onClick="back()"></form>

or anything else
you may also call the script onMouseover, onDblClick, onMouseDown, onLoad, onUnload, etc...

xataku_nakusute
07-23-2003, 06:05 AM
well....when you get into more advanced scripts, you will be insterting text, functions, variables, etc within the ()'s...

but for this particular script, you do not need to worry bout it
but, if you want, i can give you an example....?

scragar
07-23-2003, 06:06 AM
an example would be apreciated.

I am planning a game that will need the if's and prompt's to be on a loop so I must run the same function repetedly.

That's why I want all this help.

xataku_nakusute
07-23-2003, 06:17 AM
im still learning as well, but heres one example given to me by my "friend" pyro.....

.......<script type="text/javascript">
function show(txt) {
obj = document.getElementById(txt);
obj.style.display == "block" ? obj.style.display = "none" : obj.style.display = "block"; // {
}
</script>
</head>
<body>
<form><input type="button" onclick="show('name')" value="Show It"></form>
<div id="name" style="display:none">Hello World!"</div>.......

this code demonstrates how to change style properties by ID....

when the button is clicked, the div with the id of "name" appears.

notice the relationship between the div ID and the text within the ()'s.....:

..... onclick="show('name')" .....
.....<div id="name".......

now, before i help you on if's and while's and stuff of the sort, do you have any questions?

scragar
07-23-2003, 06:18 AM
I allready undestand If's, I just need help with function's, I alway's mess them up.

xataku_nakusute
07-23-2003, 06:20 AM
what part exactly do you need help on with functions?
(sorry if youve already told me....im rather slow at times;P)

scragar
07-23-2003, 06:22 AM
I just need help Identifieing them, and using them.

xataku_nakusute
07-23-2003, 06:34 AM
i dont know how much help ill be....but if what i say isnt what youre looking for, visit http://www.w3schools.com/js/default.asp
(very good stuff there)

ok......identifying functions:

.....<script type="text/javascript">
function alphanumericnameofyourfunction()......

calling them later on:

......<tagname eventname="alphanumericnameofyourfunction()">text(ifnecessary)</endoftag>.....

in the above, "eventname" may be one of the following:
onblru, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreset, onselect, onsubmit, onunload, onabort, onafterprint, onafterupdate, onbeforecopy, onbeforecut, onbeforepaste, onbeforeprint, onbeforunload, onbeforeupdate, onbounce, oncopy, oncut, ondataavailable, ondatasetchanged, ondatasetcomplete, ondragdrop, ondragstart, onerror, onerrorupdate, onfilterchange, onfinish, onhelp, onmove, onpaste, onreadystate, onresize, onrowenter, onrowexit, oinscroll, onselectstar, onstart, etc....

scragar
07-23-2003, 06:39 AM
thank's that's a great help.

see you on your forum if you ever need any help you can find me here or on my website:
onemanwar (http://onemanwar.hyperboards2.com)

xataku_nakusute
07-23-2003, 03:40 PM
ill be registering on your site now;)

scragar
07-24-2003, 05:16 AM
thank's.

If you need any help with your forum, just ask, I'm admin.

Or if you prefare e-mail me: ibewinner@cheatcc.com