zurück zur Startseite
  


Zurück XHTMLforum > Webentwicklung (außer XHTML und CSS) > Javascript & Ajax
Seite neu laden per tastendruck befehl ausführen?

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 08.02.2011, 16:11
Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 17.02.2009
Beiträge: 31
georgzed befindet sich auf einem aufstrebenden Ast
Standard per tastendruck befehl ausführen?

Hallo, ich habe eine hotornot seite und würde gerne das die user per tastendruck (Tasten 1-10) bewerten können.

wie könnte ich das hier einbaun?

HTML-Code:
  <form action="index.php" method="post" name="voteForm"> 
      <input type="hidden" name="last_view" value="<?=$row['code']?>" /> 
      <input type="hidden" name="sel_age" value="<?=$_SESSION['sel_age']?>"/> 
      <input type="hidden" name="sel_sex" value="<?=$_SESSION['sel_sex']?>"/> 
      <input type="hidden" name="sel_sex_pref" value="<?=$_SESSION['sel_sex_pref']?>"/> 
      <input type="hidden" name="country" value="<?=$_SESSION['country']?>"/> 
      <input type="hidden" name="state" value="<?=$_SESSION['state']?>"/>
      <div id="bar" class="bar">
        <div style="font-size:13px;font-weight:bold;color:#000; margin: 3px;"> 
          <strong class="barr">
            <?=SELECT_RATING?></strong>
          <span class="colorrabar">
            <?php echo $row[username]; ?>
          </span><strong> ?</strong>
        </div>
        <div id="cf">
          <div id="r0" class="volHN"> 
            <b class="Not">NOT</b>
          </div>
          <div id="r1" class="vol" onMouseOver="this.bgColor='#162EAF'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#162EAF'" onclick="document.voteForm.puntaje[0].checked=true;document.voteForm.submit();">
            <a id="a1" href="#"> 
              <input onclick="document.voteForm.puntaje[0].checked=true;document.voteForm.submit();" type="radio" value="1" name="puntaje" />1</a>
          </div>
          <div id="r2" class="vol" onMouseOver="this.bgColor='#322899'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#322899'" onclick="document.voteForm.puntaje[1].checked=true;document.voteForm.submit();"> 
            <a id="a2" href="#"> 
              <input onclick="document.voteForm.puntaje[1].checked=true;document.voteForm.submit();" type="radio" value="2" name="puntaje" />2</a>
          </div>
          <div id="r3" class="vol" onMouseOver="this.bgColor='#4E2284'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#4E2284'" onclick="document.voteForm.puntaje[2].checked=true;document.voteForm.submit();"> 
            <a id="a3" href="#"> 
              <input onclick="document.voteForm.puntaje[2].checked=true;document.voteForm.submit();" type="radio" value="3" name="puntaje"/>3</a>
          </div>
          <div id="r4" class="vol" onMouseOver="this.bgColor='#6A1D6F'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#6A1D6F'" onclick="document.voteForm.puntaje[3].checked=true;document.voteForm.submit();"> 
            <a id="a4" href="#"> 
              <input onclick="document.voteForm.puntaje[3].checked=true;document.voteForm.submit();" type="radio" value="4" name="puntaje"/>4</a>
          </div>
          <div id="r5" class="vol" onMouseOver="this.bgColor='#871759'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#871759'" onclick="document.voteForm.puntaje[4].checked=true;document.voteForm.submit();"> 
            <a id="a5" href="#"> 
              <input onclick="document.voteForm.puntaje[4].checked=true;document.voteForm.submit();" type="radio" value="5" name="puntaje"/>5</a>
          </div>
          <div id="r6" class="vol" onMouseOver="this.bgColor='#A21245'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#A21245'" onclick="document.voteForm.puntaje[5].checked=true;document.voteForm.submit();">
            <a id="a6" href="#"> 
              <input onclick="document.voteForm.puntaje[5].checked=true;document.voteForm.submit();" type="radio" value="6" name="puntaje"/>6</a>
          </div>
          <div id="r7" class="vol" onMouseOver="this.bgColor='#BF0C2F'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#BF0C2F'" onclick="document.voteForm.puntaje[6].checked=true;document.voteForm.submit();"> 
            <a id="a7" href="#"> 
              <input onclick="document.voteForm.puntaje[6].checked=true;document.voteForm.submit();" type="radio" value="7" name="puntaje"/>7</a>
          </div>
          <div id="r8" class="vol" onMouseOver="this.bgColor='#DB061A'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#DB061A'" onclick="document.voteForm.puntaje[7].checked=true;document.voteForm.submit();"> 
            <a id="a8" href="#"> 
              <input onclick="document.voteForm.puntaje[7].checked=true;document.voteForm.submit();" type="radio" value="8" name="puntaje"/>8</a>
          </div>
          <div id="r9" class="vol" onMouseOver="this.bgColor='#EB0101'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#EB0101'" onclick="document.voteForm.puntaje[8].checked=true;document.voteForm.submit();"> 
            <a id="a9" href="#"> 
              <input onclick="document.voteForm.puntaje[8].checked=true;document.voteForm.submit();" type="radio" value="9" name="puntaje"/>9</a>
          </div>
          <div id="r10" class="vol" onMouseOver="this.bgColor='#FF0000'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#FF0000'" onclick="document.voteForm.puntaje[9].checked=true;document.voteForm.submit();"> 
            <a id="a10" href="#"> 
              <input onclick="document.voteForm.puntaje[9].checked=true;document.voteForm.submit();" type="radio" value="10" name="puntaje"/>10</a>
          </div>
          <div id="r11" class="volHN"> 
            <b class="Hot">HOT</b>
          </div>
        </div>
      </div>
    </form>
oder wie müßte das javascript aussehen damit man sowas realisieren kann.
Danke!
Mit Zitat antworten
Sponsored Links
  #2 (permalink)  
Alt 08.02.2011, 16:21
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 18.06.2007
Ort: Verden
Beiträge: 405
chorn wird schon bald berühmt werden
Standard

Dafür gibt es spezielle Events

siehe Selfhtml: Test
Mit Zitat antworten
Sponsored Links
  #3 (permalink)  
Alt 08.02.2011, 16:40
Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 17.02.2009
Beiträge: 31
georgzed befindet sich auf einem aufstrebenden Ast
Standard

ok, Danke jetzt stellt sich nur noch die frage wie ich 49(tasturtaste 1) 1 in meinen formular zuordne
Mit Zitat antworten
  #4 (permalink)  
Alt 08.02.2011, 17:48
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 18.06.2007
Ort: Verden
Beiträge: 405
chorn wird schon bald berühmt werden
Standard

steht da doch schon

Code:
 onclick="document.voteForm.puntaje[0].checked=true;document.voteForm.submit();"
Mit Zitat antworten
  #5 (permalink)  
Alt 08.02.2011, 18:07
Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 17.02.2009
Beiträge: 31
georgzed befindet sich auf einem aufstrebenden Ast
Standard

und wie soll ich das einfügren? in diesen codeteil?
Mit Zitat antworten
  #6 (permalink)  
Alt 08.02.2011, 18:18
Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 17.02.2009
Beiträge: 31
georgzed befindet sich auf einem aufstrebenden Ast
Standard

ok ich glaub ich habs geschaft ist das richtig ? funktionieren tut es!

header /body:
HTML-Code:
<body onLoad="top.window.focus()" onkeydown="navigieren(event.keyCode);">
Seite:
HTML-Code:
    <form action="index.php" method="post" name="voteForm"> 
      <input type="hidden" name="last_view" value="<?=$row['code']?>" /> 
      <input type="hidden" name="sel_age" value="<?=$_SESSION['sel_age']?>"/> 
      <input type="hidden" name="sel_sex" value="<?=$_SESSION['sel_sex']?>"/> 
      <input type="hidden" name="sel_sex_pref" value="<?=$_SESSION['sel_sex_pref']?>"/> 
      <input type="hidden" name="country" value="<?=$_SESSION['country']?>"/> 
      <input type="hidden" name="state" value="<?=$_SESSION['state']?>"/>
      <div id="bar" class="bar">
        <div style="font-size:13px;font-weight:bold;color:#000; margin: 3px;"> 
          <strong class="barr">
            <?=SELECT_RATING?></strong>
          <span class="colorrabar">
            <?php echo $row[username]; ?>
          </span><strong> ?</strong>
        </div>
        <div id="cf">
        <script type="text/javascript" language="JavaScript">
function navigieren(gehe)
{
switch(gehe){
  case 49:
  document.voteForm.puntaje[0].checked=true;document.voteForm.submit()
  break
  case 50:
  document.voteForm.puntaje[1].checked=true;document.voteForm.submit()
  break
  case 51:
  document.voteForm.puntaje[2].checked=true;document.voteForm.submit()
  break
  case 52:
  document.voteForm.puntaje[3].checked=true;document.voteForm.submit()
  break
  case 53:
  document.voteForm.puntaje[4].checked=true;document.voteForm.submit()
  break
  case 54:
  document.voteForm.puntaje[5].checked=true;document.voteForm.submit()
  break
  case 55:
  document.voteForm.puntaje[6].checked=true;document.voteForm.submit()
  break
  case 56:
  document.voteForm.puntaje[7].checked=true;document.voteForm.submit()
  break
  case 57:
  document.voteForm.puntaje[8].checked=true;document.voteForm.submit()
  break
  case 58:
  document.voteForm.puntaje[9].checked=true;document.voteForm.submit()
  break

    }
}
</script>
          <div id="r0" class="volHN"> 
            <b class="Not">NOT</b>
          </div>
          <div id="r1" class="vol" onMouseOver="this.bgColor='#162EAF'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#162EAF'" onclick="document.voteForm.puntaje[0].checked=true;document.voteForm.submit();">
            <a id="a1" href="#"> 
              <input onclick="document.voteForm.puntaje[0].checked=true;document.voteForm.submit();" type="radio" value="1" name="puntaje" />1</a>
          </div>
          <div id="r2" class="vol" onMouseOver="this.bgColor='#322899'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#322899'" onclick="document.voteForm.puntaje[1].checked=true;document.voteForm.submit();"> 
            <a id="a2" href="#"> 
              <input onclick="document.voteForm.puntaje[1].checked=true;document.voteForm.submit();" type="radio" value="2" name="puntaje" />2</a>
          </div>
          <div id="r3" class="vol" onMouseOver="this.bgColor='#4E2284'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#4E2284'" onclick="document.voteForm.puntaje[2].checked=true;document.voteForm.submit();"> 
            <a id="a3" href="#"> 
              <input onclick="document.voteForm.puntaje[2].checked=true;document.voteForm.submit();" type="radio" value="3" name="puntaje"/>3</a>
          </div>
          <div id="r4" class="vol" onMouseOver="this.bgColor='#6A1D6F'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#6A1D6F'" onclick="document.voteForm.puntaje[3].checked=true;document.voteForm.submit();"> 
            <a id="a4" href="#"> 
              <input onclick="document.voteForm.puntaje[3].checked=true;document.voteForm.submit();" type="radio" value="4" name="puntaje"/>4</a>
          </div>
          <div id="r5" class="vol" onMouseOver="this.bgColor='#871759'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#871759'" onclick="document.voteForm.puntaje[4].checked=true;document.voteForm.submit();"> 
            <a id="a5" href="#"> 
              <input onclick="document.voteForm.puntaje[4].checked=true;document.voteForm.submit();" type="radio" value="5" name="puntaje"/>5</a>
          </div>
          <div id="r6" class="vol" onMouseOver="this.bgColor='#A21245'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#A21245'" onclick="document.voteForm.puntaje[5].checked=true;document.voteForm.submit();">
            <a id="a6" href="#"> 
              <input onclick="document.voteForm.puntaje[5].checked=true;document.voteForm.submit();" type="radio" value="6" name="puntaje"/>6</a>
          </div>
          <div id="r7" class="vol" onMouseOver="this.bgColor='#BF0C2F'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#BF0C2F'" onclick="document.voteForm.puntaje[6].checked=true;document.voteForm.submit();"> 
            <a id="a7" href="#"> 
              <input onclick="document.voteForm.puntaje[6].checked=true;document.voteForm.submit();" type="radio" value="7" name="puntaje"/>7</a>
          </div>
          <div id="r8" class="vol" onMouseOver="this.bgColor='#DB061A'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#DB061A'" onclick="document.voteForm.puntaje[7].checked=true;document.voteForm.submit();"> 
            <a id="a8" href="#"> 
              <input onclick="document.voteForm.puntaje[7].checked=true;document.voteForm.submit();" type="radio" value="8" name="puntaje"/>8</a>
          </div>
          <div id="r9" class="vol" onMouseOver="this.bgColor='#EB0101'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#EB0101'" onclick="document.voteForm.puntaje[8].checked=true;document.voteForm.submit();"> 
            <a id="a9" href="#"> 
              <input onclick="document.voteForm.puntaje[8].checked=true;document.voteForm.submit();" type="radio" value="9" name="puntaje"/>9</a>
          </div>
          <div id="r10" class="vol" onMouseOver="this.bgColor='#FF0000'; this.style.color='#FFFFFF'" onMouseOut="this.bgColor='#FFCC00'; this.style.color='#FF0000'" onclick="document.voteForm.puntaje[9].checked=true;document.voteForm.submit();"> 
            <a id="a10" href="#"> 
              <input onclick="document.voteForm.puntaje[9].checked=true;document.voteForm.submit();" type="radio" value="10" name="puntaje"/>10</a>
          </div>
          <div id="r11" class="volHN"> 
            <b class="Hot">HOT</b>
          </div>
        </div>
      </div>
    </form>
Mit Zitat antworten
  #7 (permalink)  
Alt 08.02.2011, 19:00
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 18.06.2007
Ort: Verden
Beiträge: 405
chorn wird schon bald berühmt werden
Standard

Sieht auch richtig aus, könnte natürlich noch schöner sein, z.B. rechnest du die Zahlen aus puntaje[7] nach den Keycodes, dann brauchst du nur ein

Code:
document.voteForm.puntaje[ keycode ]...
Mit Zitat antworten
  #8 (permalink)  
Alt 08.02.2011, 23:23
Erfahrener Benutzer
XHTMLforum-Mitglied
 
Registriert seit: 18.06.2007
Ort: Verden
Beiträge: 405
chorn wird schon bald berühmt werden
Standard

bzw. du könntest mit einem Offset arbeiten

Code:
  break
  case 50:
  document.voteForm.puntaje[1].checked=true;document.voteForm.submit()
49 => 0
50 => 1
...

da hast du immer ein Offset von 49, das lässt sich mathematisch lösen.
Mit Zitat antworten
Antwort

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Javascript nur per Klick ausführen Vevi313 Javascript & Ajax 2 06.04.2009 16:17
SQL UPDATE Befehl ohne Seitenwechsel ausführen thomas83 Javascript & Ajax 3 03.09.2008 12:08
Per .htaccess Script.php ausführen, aber Index.php anzeigen... Ares Serveradministration und serverseitige Scripte 7 21.02.2008 15:33
befehl ausführen zeitbedingt cavebird Javascript & Ajax 1 16.10.2007 12:44
JavaScript per Link auf externer Seite ausführen Engholm Javascript & Ajax 1 11.08.2006 20:23


Alle Zeitangaben in WEZ +2. Es ist jetzt 22:42 Uhr.