i new javascript, , can't seem solve problem.
i've created form looks this:
<form> <p> <input type="button" value="cr" id="cr" onclick= "window.location='http://localhost/test1/html_cr.html'" /> </p> <input type="button" value="cri" id="cri" onclick= "window.location='http://localhost/test1/html_cr.html'" /> </p> <input type="button" value="all" id="all" onclick= "window.location='http://localhost/test1/html_cr.html'" /> </p> </form> i create function objecttype(obj) can include 3 onclick events. should onclick= objecttype(obj), obj can have 3 values: cr, cri , all.
can me?
try out
function objecttype(obj) { window.location = 'http://localhost/test1/html_' + obj + '.html'; } together html
<form> <p> <input type="button" value="cr" id="cr" onclick= "objecttype(this.value);" /> </p> <input type="button" value="cri" id="cri" onclick= "objecttype(this.value);" /> </p> <input type="button" value="all" id="all" onclick= "objecttype(this.value);" /> </p> </form> because assume want re-direct url, corresponds value of each input? :-)
Comments
Post a Comment