Jump to content

[SOLVED] document.getElementById problem


robert_gsfame

Recommended Posts

i don't have any idea at all about javascript but i need it so much, can anyone help me?

 

I would like to have 2 buttons in one form,

first button will be used to execute this <form action=page1.php>

while the second button i will use to jump and execute whatever script written in page2.php

 

I know that i need to use getElementById....but i don't know how to do it, and how to pass the value into page2.php...let say

 

i have $id=$_GET['id']; then i want to pass this to page2.php, how can i do it using JS.

 

detail explanation would help a lot, thx in advance

Link to comment
Share on other sites

okay i got what i want...i don't know whether this is correct or not but it works

 

$id=$_GET['id'];

<script type="text/javascript" language="javascript">

  function _func1(){

    parameter = document.getElementById("value1").value

 

window.location="page1.php?id=<?php echo $id;?>&myparameter=" + parameter;}

</script>

 

<input type="text" id="value1">

<input type=button onclick=_func1()>

 

Is something missing ?? or this is correct?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.