Beginners Question (javascript)...
I know something is wrong with this code but I don't know how to fix it. I want to use the number associated with the onClick event to substitute for "the_Entry".
<?php
<script language=\"javascript\">
function verifyDelete(the_Entry){
varDelete = confirm('Are you sure you want to delete this?');
if(varDelete == true)
{
window.location=\"DeleteEntry.asp?Entry=the_Entry\";
}
}
</script>
?>
Thanks for your help.
Suzanne posted this at 18:54 — 8th January 2002.
She has: 5,507 posts
Joined: Feb 2000
how odd, why are you using { instead of {?
Anyway,
you need to replace language="javascript" with type="text/javascript", probably escape it out for older browsers unless it's a called function from another page.
What error are you getting? I'm a little rusty on JavaScript today (ha ha), but you might want to make varDelete var Delete.
I'm not sure, though,
Suzanne
artsapimp posted this at 19:19 — 8th January 2002.
They have: 330 posts
Joined: Apr 2000
It just redirects me to the URL:
DeleteEntry.asp?Entry=the_Entry
this BB changed it from a { to {.
Suzanne posted this at 19:53 — 8th January 2002.
She has: 5,507 posts
Joined: Feb 2000
k, then you have to make the_Entry or whatever a variable.
var the_Entry = document.forms[0].field.value;
My guess is that you need to initialize the variable.
My syntax is wildly incorrect, but hopefully that will get you started on the right solution, or maybe Vinny will show up and help!
Suzanne
javascriptworld.com -- try here, and try Dori's book for help too.
artsapimp posted this at 19:57 — 8th January 2002.
They have: 330 posts
Joined: Apr 2000
Thank you.
While playing with it I realized I had it still in the quotes. I removed it from the quotes and it worked.
<?php
<script language=\"javascript\">
function verifyDelete(the_Entry, Date){
varDelete = confirm('Are you sure you want to delete this?' + the_Entry);
if(varDelete == true)
{
window.location=\"DeleteEntry.asp?Entry=\" + the_Entry + \"&Date=\" + Date;
}
}
</script>
?>
Thank you again for your help. You got me looking in the right direction.
Free Math Test
Fun Math Games
Suzanne posted this at 02:53 — 9th January 2002.
She has: 5,507 posts
Joined: Feb 2000
Darn quotes!
I actually got stuck for two days because of a precadence problem.
Glad you found it, even with my crappy advice, lol...
S
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.