As far as I know there is no such thing as getElementsbyId there is only getElementById .
The id's have to be unique, see also w3schools
I think it is better that you give all the fields unique id's.
If the fields are not going to change and not increase at any time, then you could just do a basic if else statement.
If the fields are going to increase then just loop through them, first you have to determine the length of the fields in the form.
var form1 = document.forms[formName]
//formName being the name of the form
for (i = 0; i < form1 .length; i++) {
inp= form1 .elements[i];
if (inp.value.length == 0){
alert("Please enter value in field" + inp.name);
}
}
this is by no means 100% correct code, it may need some tweaking, its just to give u a direction to go in.
Have you used firebug with Firefox, cause i get an error in FF
first error:
cannot access optimized closure
function v(){var a=document.getElementsB...t(a)}}w(window,navigator,document);})()\n
second error:
GET http://www.dealpigeon.com/dm/image/imagelist.php?id=12
404 Not Found
Why dont you just send the name of the element or id of the element in to the onchange function, send the element using "this", so the function call could be something like this :
... onchange="callMe('elementId')"
or
... onchange="callMe(this)"
Then inside the callMe function u will then have the element ID or the element object available to you.
My pleasure, please mark this thread solved if your question has been answered to your satisfaction.
Nope, Ajax is client side, so no need to do any server side configurations.
You weren't really calling the function, it starts running when the page loaded. I see that you are changing the href attribute to a hash inside the loop, so i modified your code to look like this:
<html>
<body>
<form>
<a onclick="change(this)" id="static" href="#">link1</a></br>
<a onclick="change(this)" id="static" href="#">link2</a></br>
<input type="text" id="spec" name="content"/>
</form>
<script>
function change(object){
var inputobj = document.getElementById("spec");
inputobj.value = object.innerHTML;
}
</script>
</body>
</html>
If u click on the links than that "innerhtml" is displayed in the textbox.
I had removed the loop since there was no need to have it, as all u want to achieve is click on the link and the value appear in the text box
when i first loaded this code into firefox it gave an error, then i changed this line:
#
function addit = function()
to this:
#
function addit ()
and it works in both FF 3.5 and IE 8
Are u then using a mysql database or an oracle database?
The commands to create tables and insert data are the same. what u can do is get sqldeveloper, then just create connections to the database, and then you can run the create and insert sql statements from there.
I would suggest netbeans as an IDE, its much easier than jdeveloper or eclipse with regards to ease of use.
I have never used the toplink program but to me it seems as though it just "creates" the sql statements for you.
Regarding mysql and oracle, they both require different drivers, other than that it should be ok to use the same code
what is the use....
sorry I don't understand your question.
i have used it, but it has been a while, Oracle 10G works just like any other database, it also has a console where you can do all the data admin stuff.
NoclassDefError, normally stems from not being able to find the class, in your case TagLibraryValidator
Ensure that this class is in the lib directory of your application
what you could do is preload the image and set its visibility to be hidden, then on the onclick event of the checkbox, you can just set the image to be visible.
OR
you can have a div next to the checkbox, then on the onclick even just change the innerhtml of that div to display an image.
u have to change the innerhtml of td tag.
so the onmousover event will look something like this:
onmouseover = "document.getElementById('tdId').innerhtml='<img src='imgname.jpg'>' "
If the information has been posted to the servlet, using request.getParameter will display the information passed.
You would use it something like this:
request.getParameter("firstname")
hello, i'm a student trying create a website using javascript. i am not familiar with javascript and i must use it to change only the content on my page. i have been stuck on this for days and i just cannot get it right.
a good place to learn javascript is w3schools
using the 960 grid on the website what is the code to remove the behavior of my sidebar links?
I have no idea what this means
also how do i add an onClick feature to my sidebar links?
you add an onclick event like this:
<a onlick="somejsfunction()">click here</a>
the last question i have is. what is the correct code to change only the content of the page while everything else remains the same??
for this you will use ajax, which you can also learn at w3schools here
I am not sure sure if this will help, but i had done something a similar, what i did is create a json string using javascript on my jsp page after button was clicked, then sent the json string using ajax to a servlet. In the servlet i used request.getParameter to get the json string, then looped over it using the libraries from the json.org site
You could do a check on the value something like
if (tBox.value != ""){//proceed to next question}else{alert("Please enter a value in the textbox")}
Without being able to see your code, all i can say is that u can do a comparison on the value returned by responseText, something like
if (responseText == "no"){
//do something}else{//do something else}
@Peter_budo, based on his question, i think that i am correct in saying that it cant be done, one can use ajax, but you will still need a server side language, one cannot connect directly to the database just using javascript.
<c:redirect url="http:www.someurl.com" />
Yes you can.
use DATABASE_NAME
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
I dont think you can do that, you are going to need a server side language, like ASP, Java, PHP etc that will be able to communicate with the database.
can you please provide some code, it would make it easier to help you.
By numeric validation do u just want to validate that numeric characters were entered in the form?
To display a bigger image you can use teh width and height attributes of the img tag, just as you have done in the code presented.
to change the display to more than 12, in the code that gets the records from the database must be limiting it to 12.
The code that you have provided will only display one image, there should be more code than that. you will have to provide teh rest of the code for more help on increasing the number of pictures to display
do a google search for "javascript example autocomplete" loads of examples are then available
You run javascript in a browser, u can include it inside the html file or link it to the html file by calling the javascript file (yes the name should be filename.js) (filename being whatever name you want to call it.)
the best place to find the basics about javascript is at w3schools
They will show the same name because you can only hard code one element id, what u can do is this:
onmouseover=fu(this)
then in the javascript function change it to this:
function fu(el){
alert(el.name);
}
by sending in the this property u are sending the element object to teh function and thus will be able to retrieve any attribute of that element.
I think you should add the javascript provided to a function then call the function using the body onload event, it will then work.
The .html file did not recognize/read the .css file?
Thats very strange, could u place the code that u are using with the style inside the same file please, and i can take a look as to why it isnt reading it.
Yes, i dont know what your table structure is, but u can put it in a field.
You can create a url field in one of your tables and insert into that field.
I see that your original problem http://www.daniweb.com/forums/thread229724.html has been solved please mark that as solved so that people dont answer a thread that has already been solved.
Now onto your new problem, the code that is causing your page to open in a new window on page3.html is this:
<a href="page4.html">click</a>
What u need to do is call the same ajx function you use in the menus.
<a style="cursor:pointer" onclick="open_page('page4.html','content')">click</a>
I dont know much about php, but I do know that you can only insert data into a database using a server side language, so you are going to have to edit your php page.
Try increasing the size of the textbox by using the width attribute.
<input type="text" style="width:250px" name="tBox1" />
You are using a stylesheet, which i presume should be the same for all teh pages. I dont see how it can be looking different. Would it be possible to paste the code for teh two pages that are looking different.
I dont know anything about tripod/lycos but from the code you have provided, in order to change where the page goes to after submission, you are going to have to edit the file referred to in teh action atttribute.
As to why the submit button is greyed out, unfortunately nothing in the code provided can explain that one.
Best thing will be to contact their support and not give up until they answer you.
You almost had it, just teh slashes have to be backward slashes so link should look something like this:
\\servername\fioldername\filename.blah