Click to See Complete Forum and Search --> : Need help plz


DummyNewbie
07-27-2003, 06:02 AM
hi, im new and im trying to make a good website. i turned to JavaScript but all i get is errors =/.

1) i want to make a comments section using js. i tryed document.write but all that came down to is a blank page with the text. i wanted it to carry on from the bottom of the page, but i cant seem to find out how to do it. if it is possble then can any of you tell me how to do it plz?

2) i know how to do a popup window etc. but i cant do it with a link. all i get are errors or object expected. can any of you help me with that too?

thx alot

Mr J
07-27-2003, 06:07 AM
To answer your first question you will have to post your code.

In answer to your second question



Using a form button

<FORM>
<input type="button" Value="Open New Window" ONCLICK="window.open('targetpage.htm','win1','width=300,height=300')">
</FORM>

Using a link

<A HREF="#null" ONCLICK="window.open('Your Page.htm', 'win2','width=300,height=100,left=450,top=250,toolbar=yes');return false">Your Link</A>

Using a script

<script>
function newWin(theURL){
var newWin=open((theURL),'','width=200,height=100,top=300,left=250' );
}
</script>

All the link codes that require a window of the above size and position are then as follows;

<a href="javascript:newWin('yourpage.htm');">Your Link</a>

Charles
07-27-2003, 06:11 AM
1) Be wary of using JavaScript, about 13% of users do not use it. If you are not careful, you'll end up with a page that falls flat on its face for those good people.

2) This doesn't mean that you shouldn't use JavaScript. You need to think before you code and make sure that everything "fails safe". Use the following to open a link in a new window:

<a href="http://www.w3.org/" onclick="window.open(this.href, 'child', 'height=400,width=300); return false">W3C</a>

DummyNewbie
07-27-2003, 06:34 AM
My code:
<script language="javascript">
function comment()
{
if (form.name1.value == " ")
{
alert("Please enter a correct name")
}
else
{
document.write(form.name1.value)
}
}
function commenttext()
{
if (comment.value ==" ")
{
alert("Please write a comment")
}
else
{
document.write(form.comment.value)
}
}
</script>

then:
<input type="button" value="Submit" name="submit" onclick="comment(); commenttext()">

i havnt done the comment box yet, this is only the name part of it.

now come to think of it, i think i need asp. coz if you refresh the page, it goes back to normal again... or it might just be me

i just edited the post with my comment box script. when i enter the name and comment it only displays the name =/