Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Posts posted by jesh

  1. Does this do what you need?

    SELECT m.idModelo, m.nombre, p.nombreProceso, ca.nombreCategoria, co.nombreColor AS colorFROM modelos m    INNER JOIN procesos p ON m.idProceso = p.idProceso    INNER JOIN categorias ca ON m.idCategoria = ca.idCategoria    INNER JOIN coloresModelos cm ON m.idModelo = cm.idModelo    INNER JOIN colores co ON cm.idColor = co.idColor

  2. You might try this:

    <script type="text/javascript">function getValue(){	var r = document.getElementById('field1').value	document.getElementById("TextValue").innerHTML = r;}</script><div id="TextValue"></div><input type="text"value="hallo"name="field1" onblur="getValue();" />

  3. I don't know that I've personally ever seen a website that is able to change my browser so that the window is in fullscreen mode. I'm not sure it's possible. What is possible is to open a new window with no toolbars, no status bar, etc and specify the width to be the width of the visitor's monitor and the height to be the height of the visitor's monitor, thus filling the screen with the browser. To do this, you need to get the size of the visitor's screen using javascript and then use those values in your window.open function. This link might help you in that regard: http://www.javascriptkit.com/howto/newtech3.shtml

  4. First, for changing the background color of the entire cell rather than just the span, you can do something like this:

    // rather than:// totalCell.innerHTML = "<SPAN STYLE='background-color: #FF0000;'>"+total+"</SPAN>";// try this:totalCell.style.backgroundColor = "#ff0000";totalCell.innerHTML = total;

    As for the other problem, I'm not entirely certain what you are trying to accomplish. Are you trying to loop through an array to add up all the elements to come up with a total? If so, try this:

    var total = 0;for(var i = 0; i < myarray.length; i++){	total += myarray[i];}

  5. An example (slightly modified...) of reportingsjr's method could look like this:

    <html><head><style type="text/css">#Content { display: none; }</style><script type="text/javascript">function LoadComplete(){	// hide the loading panel.	document.getElementById("Loading").style.display = "none";	// show the content panel.	document.getElementById("Content").style.display = "block";}// run the function as soon as the window is finished loading.window.onload = LoadComplete;</script></head><body><div id="Loading">Please wait while the site loads...</div><div id="Content"><!-- Your page goes here...-->  <img src="image1.jpg" />  <img src="image2.jpg" />  <img src="image3.jpg" />  <img src="image4.jpg" />  <img src="image5.jpg" />  <img src="image6.jpg" />  <img src="image7.jpg" />  <img src="image8.jpg" /></div></body></html>

    Date

    To each his/her own. I typically use the DB to generate dates because our application currently runs on multiple web servers and a single DB server. If I were to get the date off of one of the web servers, it could be slightly different than a date on one of the other web servers whereas if I get it off the DB server, all dates/times will be according to the same clock for all records.But, either way works. :)

  6. The idea here is that you specify a target for a link and the link will open up a new window and name that window with the target you specified. Any time the link is clicked after that, the window that opened up the first time you clicked on the link will be refreshed:

    <a href="http://www.google.com/" target="ComeGetSome">Here</a>

    Rather than a new window popping up each time you click that link, there will be only one window that opens and each time you click the link the window will refresh. A better example might be this:

    <a href="http://www.google.com/" target="ComeGetSome">Google</a><a href="http://www.w3schools.com/" target="ComeGetSome">W3Schools</a><a href="http://www.wikipedia.org/" target="ComeGetSome">Wikipedia</a>

  7. Yeah, I've run into this problem before. The following does not work:

    var div = document.getElementById("Container");div.innerHTML = "<script>alert('hello!');<\/script>";

    It's possible that it is because of browser security, I'm not certain. It does work, however, if you use the method I described in my previous post (i.e. the eval(script.innerHTML)).

  8. hi, does any one know how to display image saved in access database? FYI, i managed to saved in access using Ole Object but later got problem when want to display the image saved before.Any idea?
    This article might help: http://www.codeproject.com/aspnet/image_asp.aspThe article was written for MySQL database, but it should help for any DBMS. The key point is when you get the data from the database, you'll use the Bitmap class to create a bitmap from a MemoryStream and send that bitmap to the browser:From the article:
    byte []buffer = data.getImage(imagenumber); System.IO.MemoryStream stream1 = new System.IO.MemoryStream(buffer,true); stream1.Write(buffer,0,buffer.Length); Bitmap m_bitmap = (Bitmap) Bitmap.FromStream(stream1,true); Response.ContentType = "Image/jpeg"; m_bitmap.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
  9. Can you tie in the code that you want to execute into your onreadystatechange handler in the XMLHttpRequest? That readystatechange event happens at each step in the creation, opening, sending, and receiving stage of the request. If you only execute code when the readyState property of the XMLHttpRequest is 4 ("complete"), it would essentially act like an onload event.It might also help to see some of your code.EDIT: If you want to execute code that is in the files that you are getting using AJAX, then you might try something like this:

    // get a reference to the element that is the container for the datavar div = document.getElementById("TheContainerDiv");// assign the content received from AJAX to the innerHTML of the div:div.innerHTML = ajax.responseText;// next, look in the div to see if there are any script elements:var scripts = div.getElementsByTagName("script");// loop through all the scripts:for(var i = 0; i < scripts.length; i++){	if(scripts[i].type = "text/javascript")	{		// eval what's in the script element		eval(scripts[i].innerHTML);	}}

    Some key points need to be made here, however.1) All the script elements in the files that you are getting with AJAX need to end with <\/script> rather than </script>.2) You'll want to be real sure that the code that is in those script elements is safe to be eval'd.I hope this helps.

  10. If you mean you want to be able to type in a URL into a text box and then click a button to redirect the browser to that URL, then the answer is yes!Check out the HTML DOM tutorials. I'd say way more than half of the scripting web developers do on the client side involves HTML DOM rather than javascript. It's worth it to learn as much as you can about it.In the meantime, what you want would look something like this:

    <input type="text" id="URLInput" /><button onclick="doit();">Go there!</button><script type="text/javascript">function doit(){	// get the value that is stored in our "URLInput" text box	var url = document.getElementById("URLInput").value;	// check to see if there is a value	if(url != "")	{		// we found a value, let's redirect there.		location.href = url;	}}</script>

    You'd probably want to figure out some way to validate the user's input so that you only redirect when the input is a valid URL. If someone typed in "test" and clicked the button, that person would get an error. I'll leave that up to you.I hope this helps!

  11. ahh, thankyou so very much . works perfect now! I realise the mistake in the nav code now .. and .. i now know how to get round the main content part - thanks alot jesh! x
    Cool, I'm glad it worked. I wasn't able to test it in IE because I was using the Firebug extension to Firefox. If you haven't downloaded that extension yet, you ought to check it out!Anyhow, good luck with the site!
  12. I edited the CSS file to display your page correctly in Firefox. Here are the changes I made:

    div.nav{ background: #000000 url(../images/navback.gif); height: 27px; font-weight: bold; margin-top: -4px; padding-left: 8px;}div.nav span.link{ display: block; float: left; color: #CD983B;/* got rid of the extra { */ margin-top: 8px; padding: 0px; font-weight: bold; padding-left: 12px;}div.nav a{ display: block; float: left; color: #ffffff; text-decoration: none; padding: 6px; margin-top: 3px;}div.main .mainRight{/* rather than float, use margin here */ margin-left: 150px; padding: 4px 0px 4px 2px;}
  13. First thing I see is that you have this in your style.css file:

    div.nav span.link{	display: block;	float: left;	color: #CD983B;	margin-top: 10px;	padding: 6px 0px 6px 10px;}	font-weight: bold;	padding-left: 20px;}

    Perhaps this is the cause of your problems.

  14. But... lets say we want to join one table with values from a second AND a third table...how do I perform multiple inner joins without creating messy code such as M$ access produces? I mean, for the actual knowledge of writing correct various inner joins, I'd just like to know so I can do this without any help in the future.
    Maybe an example would help. Suppose, based on your original post, you had the following:
    Table: users-----------------idUseruserNamepasswordTable: products-----------------idProductdescriptionTable: orders-----------------idOrderidProductidUser
    A query to get the username of the user and the description of the product for each order would look like this:
    SELECT users.userName, products.descriptionFROM ordersINNER JOIN users ON orders.idUser = users.idUserINNER JOIN products ON orders.idProduct = products.idProduct

    It all really depends on how each of the tables relates to one another.Also, when JOINing tables, it might help to look into using LEFT JOINs and RIGHT JOINs if necessary. The W3Schools page on SQL JOINs helped me when I was first learning: http://www.w3schools.com/sql/sql_join.asp

  15. It'd be just like justsomeguy posted:

    <?php$id = intval($_GET['id']); //news.php?id=xxx$result = mysql_query("SELECT * FROM news WHERE id={$id}");if (!($news = mysql_fetch_assoc($result)))  die("No news item found");mysql_free_result($result);echo "<div class=\"headline\">" . htmlentities($news['title']) . "</div>";echo "<div class=\"newsbody\">" . nl2br(htmlentities($news['body'])) . "</div>";?>

    It will display any news item, and you only have to change this code if you want all news items to change.

  16. If you decide to build your own, an easy way to implement this in .NET is to handle it in the Application_BeginRequest event handler in the Global.asax.cs (or Global.asax.vb if you're using VB) file.

    using System.Web;public class Global : HttpApplication{	protected void Application_BeginRequest(Object sender, EventArgs e)	{   // This method runs as soon as a request is sent to the web server for		// any resource in your .NET website.  You can get the path to the file here.		string path = HttpContext.Current.Request.Url.AbsolutePath;		// "path" will now store the file name for your page.  This is where		// you could put the code to increment a counter that keeps track of		// how many times the page has been loaded.  This data could be		// stored in a database or in a file on the server's hard drive.		// Once all the code in here executes, the request gets sent on its		// merry way.	}}

×
×
  • Create New...