Jump to content

Search the Community

Showing results for tags 'var'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 6 results

  1. I am looking for either in css a way to take data from the device used to input as an attribute or a way to combine css and javascript to do the same thing. there may be a variable in css now but it isn't a true variable as far as I have found so far in the tutorial and the info I want I have only seen accessed using javascript so wanted to try combining it with the css I already have. I am looking to basically create a title page with css at the top of a website or in my case an actual ebook. I have this most of the way done. I want it to survive multiple devices so I want a variable height and width and I found that but the height is not quite perfect yet. I am using 100vh for 100% viewport height meaning the entire screen height but what I really want is the full window height. there is a javascript function in the tutorial that gives you the window.innerheight but I don't know how to input that number into my height attribute. right now that 100vh height is making it so that the footer is just beyond the screen and I have to scroll down a little to see it. but what I want it to do is that there is no scrolling needed because it fits perfectly on the screen. here is the code as is. <html> <head> <title>Title Page Template</title> <style> .title { display: flex; position: absolute; height: 100vh; width: 100vw; flex-direction: column; align-items: center; justify-content: center; z-index: -1; } .title > div { width: 100%; margin: 10px; text-align: center; } .copy { display: flex; height: 100vh; width: 100vw; align-items: flex-end; justify-content: center; } .copy > div { width: 100%; text-align: center; } p.large { font-weight: bold; margin-top:1em; font-size: 200%; text-indent: 0em; text-align:center; } p.medium { margin-top:1em; font-weight: bold; font-size: 150%; margin-top:1.0em; text-indent: 0em; text-align:center; } p.small { font-weight: bold; margin-top:1em; font-size: 125%; text-indent: 0em; text-align:center; } </style> </head> <body> <div class="title"> <div><p class="large" id="start">Title</p></div> <div><p class="medium">The Sub-title</p></div> <div><p class="small">By <i>Author</i></p></div> </div> <div class="copy"> <div><p class="small">Publisher &#169; 2019</p></div> </div> </body> </html> and here is the javascript code I found that gets the info I want <html> <body> <p>Click the button to display this frame's height and width.</p> <button onclick="myFunction()">Try it</button> <p><strong>Note:</strong> The innerWidth and innerHeight properties are not supported in IE8 and earlier.</p> <p id="demo"></p> <script> function myFunction() { var w = window.innerWidth; var h = window.innerHeight; document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h; } </script> </body> </html> is there a way to get the innerheight and innerwidth into my css to finish this title page design?
  2. Hello. Stupid question here. So when i write sql code inside variable, do i need to change it (the variable) everytime or will php be able to see to difference? Lile this: $sql = "select * from users" $result = execute sqk here... $row = output here.. fetch data... $sql = "select * from stars" ... And so forth? Or do i need to change the variable everytime so php can know each different sql code and fetches everytime? Thx in advance.. Ps: writing from a cellphone, sorry if i dont deliver perfect info, so hope you understand the question If not, ask and ill retype the question when home later tonight at my laptop Thanks a lot
  3. Hello! I'm working in a viewer with openlayers and with geoserver and I want to filter layers by a variable. I'm not going to ask anything about geoserver nor openlayers. My problem is about put variables in a url. To obtain geoserver layers from openlayers you have to call them by a url and to filter them you have to use CQL_FILTER. (Filter to shows only what the user wants). My viewer works fine if I put a simple value to filter: (gid_cuenca_id is a db column) var imbornalesSource = new ol.source.ServerVector({ format: new ol.format.GeoJSON(), loader: function(extent, resolution, projection) { var url = 'http://localhost:8080/geoserver/cia/wfs?service=WFS' + '&version=1.1.0&request=GetFeature&typename=cia:imbornales&PROPERTYNAME=gid_cuenca_id&CQL_FILTER=gid_cuenca_id=1&' + 'outputFormat=text/javascript&format_options=callback:imbornalesloadFeatures' + '&srsname=EPSG:3857'; $.ajax({ url: url, dataType: 'jsonp' }); }, projection: 'EPSG:3857' }); However, if I try to put a variable in the url, I receive an error: Uncaught SyntaxError: Unexpected token <I wanted to know if there is any way to put the variable's value as if it was a simple value. var myVar = 1;var tramosSource = new ol.source.ServerVector({ format: new ol.format.GeoJSON(), loader: function(extent, resolution, projection) { var url = 'http://localhost:8080/geoserver/cia/wfs?service=WFS' + '&version=1.1.0&request=GetFeature&typename=cia:tramos&PROPERTYNAME=gid_cuenca_id&CQL_FILTER=gid_cuenca_id=myVar&' + 'outputFormat=text/javascript&format_options=callback:tramosloadFeatures' + '&srsname=EPSG:3857'; $.ajax({ url: url, dataType: 'jsonp' }); }, projection: 'EPSG:3857' }); Thank you very much!!
  4. Hi guys, I use a very big form and my variables will be saved in a session. In most cases I´m fine with PHP. Until now I just use JS to hide and show some options. My idea is to give the user a selection (somewhere in my form). As soon as the user clicks on one of the selection options, the value of the variable shall appear as text below the selection options (not just in the selection options). 1. Idea - import the php-variables in my JS and work with it <script type="text/javascript">var test ="<?php echo $test ?>";</script> --> didnt work. I could work with the variable, but I dont get a "fresh" variable from the session, because I would have to push the form button first. 2. Idea - create a JS variable in the selection options <selection id="test"><option value=test1">Test1</option><option value=test2">Test2</option>...</selection> --> didnt work. Do you have any ideas what I should look for or what I have to do? Thanks and cheers, Chrex
  5. Hi! My problem is that I've made a function with "var kgTotales = 0". But when I sum "kgTotales = kgTotales + 2" the result is "02", it returns a string and not a number. I use this var in a bucle so the result is "kgTotales = 02...." and next to it the next numbers I want to sum. This is the code: <script type="text/javascript"> function multiplicar() { var contador1; var contador2 = 2; var contador3 = 1; var n1; var n2; var id1; var id2; var id3; var kgTotales = 0; var precioTotal = 0; for(contador1=1; contador1 < 60; (contador1)+2){ id1="n" +(contador1); id2="n" +(contador2); id3="result" +(contador3); contador1=(contador1)+2; contador2=(contador2)+2; contador3++; n1=document.getElementById(id1).value; n2=document.getElementById(id2).value; document.getElementById(id3).value = (n1*n2); precioTotal = precioTotal + (n1*n2); kgTotales = kgTotales+n2; document.getElementById("precioTotal").value = precioTotal + " Euros"; document.getElementById("kgTotales").value = kgTotales + " Kg"; } } </script> And this is the result: I don't understand why it happens because precioTotal is a similar var and also shows a sum and works well. I hope someone could helps me. Regards!
  6. Hey all .. I do a tes for make a global varibel in Javascriptfirst time I try like it var satu = 10;var dua = 5;function hitung(){document.write(satu+dua);} no problem so far,.. and I try for second like this: I want display a tag hidden with action onClick , var mun = document.getElementById("mun");function muncul(){ mun.style.display ="block";}<a href="#" onClick="muncul();">Tes For Muncul</a><div id="mun" style="display:none;">Saya Akan Muncul Disini Baby</div> its not work so I try for the third like this: function muncul(){var mun = document.getElementById("mun");mun.style.display ="block";}<a href="#" onClick="muncul();">Tes For Muncul</a><div id="mun" style="display:none;">Saya Akan Muncul Disini Baby</div> and it's run very well ; So , I had a question whether a tag can't be for a global Variabel , cause I have need variable same for any function, Thanks
×
×
  • Create New...